<template>
  <div class="container">
    <div class="nav">
      <van-nav-bar title="签到" @click-left="$router.push('/mine')">
        <template #left>
          <van-icon name="arrow-left" size="1rem" color="black" />
        </template>
      </van-nav-bar>
    </div>
    <div class="content">
      <div class="header">
        <div class="signBox">
          <div class="signBoxDetail">
            <div>
              <span>一 已连续签到 一</span>
              <div class="signDay">
                <span>1</span>天
              </div>
            </div>
            <button class="signBtn" @click="show=true">签到</button>
          </div>
        </div>
      </div>
      <div class="detail">
        <div class="signDate">
          <ul class>
            <li v-for="(item,inx) in dateList" :key="inx" :class="item.check && 'active'">
              <i class="iconfont icon-roundcheckfill" />
              <span>{{item.title}}</span>
            </li>
          </ul>
        </div>

        <dl class="signRule">
          <dt>签到规则</dt>
          <dd>1.连续签到1天可得:10积分,0.5红包,2成长值</dd>
          <dd>2.连续签到2天可得:20积分,0.2红包,5成长值</dd>
          <dd>2.连续签到3天可得:30积分,0.3红包,9成长值</dd>
          <dd>用户可在签到页进行每日签到一次，签到按设置的每日奖励进行发放，连续签到天数大于设置的天数，按最后一日的奖励进行发放；若签到中断则重新计算；</dd>
        </dl>
      </div>
    </div>
    <van-overlay :show="show" @click="show = false">
      <div class="signResult">
        <img src="https://uniapp.b2b2c.niuteam.cn/upload/uniapp/signin/bg1.png" alt />
        <div class="resultContent">
          <span>恭喜您获得</span>
          <div class="reward">
            <img src="https://uniapp.b2b2c.niuteam.cn/upload/uniapp/signin/point.png" alt />
            <span class="rewardTitle">积分</span>
            <span style="color:#09db98">10</span>
          </div>
          <div class="reward">
            <img src="https://uniapp.b2b2c.niuteam.cn/upload/uniapp/signin/hb.png" alt />
            <span class="rewardTitle">红包</span>
            <span style="color:#09db98">10</span>
          </div>
          <div class="reward">
            <img src="https://uniapp.b2b2c.niuteam.cn/upload/uniapp/signin/money.png" alt />
            <span class="rewardTitle">优惠卷</span>
            <span style="color:#09db98">10</span>
          </div>
          <span class="signTip">明日签到可获得积分+20,红包+20</span>
        </div>
      </div>
    </van-overlay>
    <!-- <div>
      <img src="https://uniapp.b2b2c.niuteam.cn/upload/uniapp/signin/bg1.png" alt />
    </div>-->
  </div>
</template>

<script>
import { NavBar, Icon, Overlay } from "vant";
export default {
  components: {
    "van-nav-bar": NavBar,
    "van-icon": Icon,
    "van-overlay": Overlay
  },
  data() {
    return {
      show: false,
      dateList: [
        {
          title: "6.20",
          check: true
        },
        {
          title: "6.21"
        },
        {
          title: "6.22"
        },
        {
          title: "6.23"
        },
        {
          title: "6.24"
        },
        {
          title: "6.24"
        },
        {
          title: "6.25"
        }
      ]
    };
  }
};
</script>

<style lang="less" scoped>
.container {
  height: 100%;
}

.content {
  background: linear-gradient(180deg, #09db98, #09b5db);
  .header {
    background-color: #09db98;
    padding: 2rem 0 0;
    .signBox {
      margin: 0 auto;
      width: 11rem;
      height: 11rem;
      background: url(https://uniapp.b2b2c.niuteam.cn/upload/uniapp/signin/bg2.png)
        left top/contain no-repeat;

      color: white;
      font-size: 0.75rem;

      .signBoxDetail {
        flex-direction: column;
        height: 100%;
        justify-content: space-between;
        align-items: center;
        display: flex;
        padding: 3.4rem 0 1.6rem;
        box-sizing: border-box;
        text-align: center;
        .signDay {
          padding-top: 0.25rem;
          > span {
            font-size: 1.9rem;
            font-weight: 600;
          }
        }
        .signBtn {
          background-color: #ffd44c;
          color: #7e2900;
          padding: 0.2rem 1.8rem;
          border: none;
          outline: none;
          font-weight: 600;
          border-radius: 0.8rem;
        }
      }
    }
  }

  .detail {
    padding-top: 0.4rem;
    .signDate {
      display: flex;
      justify-content: center;
      ul {
        display: flex;
        li {
          padding: 0 0.4rem;
          position: relative;
          display: flex;
          flex-direction: column;
          align-items: center;
          color: white;

          &::before {
            content: "";
            position: absolute;
            width: 0.4rem;
            height: 2px;
            background-color: #e5e5e5;
            left: 0;
            top: 0.6rem;
          }
          &::after {
            content: "";
            position: absolute;
            width: 0.4rem;
            height: 2px;
            background-color: #e5e5e5;
            right: 0;
            top: 0.6rem;
          }

          &:first-child::before {
            display: none;
          }
          &:last-child::after {
            display: none;
          }
          > span {
            font-size: 0.65rem;
          }
          > i {
            color: rgba(0, 0, 0, 0.2);
            font-size: 1.1rem;
          }
        }
        .active {
          > i {
            color: white;
          }
        }
      }
    }
    .signRule {
      margin: 0;
      color: white;
      padding: 0.6rem;
      dt {
        font-size: 0.75rem;
        padding-bottom: 0.4rem;
      }
      dd {
        line-height: 1.9;
        font-size: 0.5rem;
        margin: 0;
        line-height: 1.8;
        &:last-child {
          padding-top: 0.3rem;
        }
      }
    }
  }
}

.signResult {
  position: relative;
  > img {
    position: absolute;
    height: 10.2rem;
    width: 12rem;
    left: 0;
    right: 0;
    margin: 0 auto;
    z-index: 9;
  }
  .resultContent {
    padding: 0.4rem;
    background-color: white;
    position: absolute;
    top: 9.5rem;
    width: 11rem;
    left: 0;
    right: 0;
    margin: 0 auto;
    border-radius: 0.6rem;
    font-size: 0.75rem;
    text-align: center;
    img {
      width: 1rem;
      height: 1rem;
    }
    .reward {
      padding: 0.15rem 0;
      display: flex;
      align-items: center;
      justify-content: center;
      .rewardTitle {
        padding: 0 0.2rem;
      }
    }
    .signTip {
      padding: 0.4rem 0;
      color: #898989;
      font-size: 0.6rem;
    }
  }
}
</style>